package com.example.logdemo.config;

import com.mzt.logapi.beans.Operator;
import com.mzt.logapi.service.IOperatorGetService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Optional;

/**
 * @version 1.0
 * @author: ZackYoung
 * @date: 2021/4/1 11:05
 */
@Configuration
public class LogRecordConfiguration {

    @Bean
    public IOperatorGetService operatorGetService() {
        return () -> Optional.of("1239")
                .map(a -> new Operator("456"))
                .orElseThrow(() -> new IllegalArgumentException("user is null"));
    }
}

